package com.whj.servicedriveruser.controller;


import com.whj.internalcommon.dto.DriverUserWorkStatus;
import com.whj.internalcommon.dto.ResponseResult;
import com.whj.servicedriveruser.service.DriverUserWorkStatusService;
import com.whj.servicedriveruser.service.impl.DriverUserWorkStatusServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author whj
 * @since 2023-01-15
 */
@RestController

public class DriverUserWorkStatusController {

    @Autowired
    private DriverUserWorkStatusService driverUserWorkStatusService;

    /**
     * 修改司机的状态信息
     * @param driverUserWorkStatus
     * @return
     */
    @PostMapping("/driver-user-work-status")
    public ResponseResult changeWorkStatus(@RequestBody DriverUserWorkStatus driverUserWorkStatus){

        Long driverId = driverUserWorkStatus.getDriverId();
        Integer workStatus = driverUserWorkStatus.getWorkStatus();
        return driverUserWorkStatusService.changeWorkStatus(driverId,workStatus);
    }
    @GetMapping("/work-status")
    public ResponseResult<DriverUserWorkStatus> getWorkStatus(Long driverId){
        return driverUserWorkStatusService.getWorkStatus(driverId);
    }
}
